{% extends "BluehouseappWebBundle:Backend/Admin/layout:layout.html.twig" %}
{% from 'BluehouseappWebBundle:Macros:misc.html.twig'  import pagination %}
{% import 'BluehouseappWebBundle:Macros:buttons.html.twig' as buttons %}

{% block title %}
    审计管理
{% endblock %}
{% block body -%}
    {%  set entities=audits %}
    <div class="page-header">
        <h2>审计管理</h2>
    </div>
    {{ pagination(entities) }}
    <table class="table  table-striped table-hover table-condensed">
        <thead>
            <tr>

                <th>信息</th>

                <th>内容</th>

                <th>操作</th>
            </tr>
        </thead>
        <tbody>
        {% for entity in entities %}
            <tr>

                <td>id:{{ entity.id }}|type:{{ entity.type }}|name:{{ entity.name }}</td>
                <td>


                {%  if entity.type=='post' %}
                    <a href="{{ path('post_show', { 'id': entity.entityId }) }}">
                        {{ entity.content |striptags|raw|nl2br}}
                    </a>
                {% else %}
                    {{ entity.content |striptags|raw|nl2br}}
                    {% endif %}
                </td>
                <td>
                <ul>
                    {% if entity.type=='post_comment' %}
                        <li>
                            {{ buttons.delete(path('bluehouseapp_audit_postcomment_delete', { 'postCommentId': entity.entityId ,'auditId':entity.id})) }}
                        </li>
                    {% elseif entity.type=='post' %}
                        <li>
                            {{ buttons.delete(path('bluehouseapp_audit_post_delete', { 'postId': entity.entityId ,'auditId':entity.id})) }}
                        </li>
                    {% endif %}
                </ul>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {{ pagination(entities) }}


    {% endblock %}
